﻿using SRB.Tg.Cad_Bll;
using SRB.Tg.DrawingStandard;
using SRB.Tg.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Teigha.DatabaseServices;
using Teigha.Runtime;

namespace SRB.Tg.Cad
{
    public class PierSubstructureDrawing
    {
        public void DrawingPier(Database db,string pierParaFile, double selectScale, PierSubstructureType type)
        {
            int OverAllScale = (int)selectScale;
            System.Data.DataTable dtProject;

            DrawingPierStructure P1 = new DrawingPierStructure(pierParaFile, type, out dtProject,true);
            //Database db = HostApplicationServices.WorkingDatabase;
            P1.DrawingPier(db, OverAllScale);
        }

        public void DrawingPier(string pierParaFile, double selectScale, PierSubstructureType type)
        {
            int OverAllScale = (int)selectScale;
            System.Data.DataTable dtProject;
            DrawingPierStructure P1 = new DrawingPierStructure(pierParaFile, type, out dtProject);
            Database db = HostApplicationServices.WorkingDatabase;
            P1.DrawingPier(db, OverAllScale);

            //using (Services svc = new Services())
            //{
            //    SystemObjects.DynamicLinker.LoadApp("GripPoints", false, false);
            //    SystemObjects.DynamicLinker.LoadApp("PlotSettingsValidator", false, false);

            //    HostApplicationServices.Current = new HostAppServ(svc);
            //    Environment.SetEnvironmentVariable("DDPLOTSTYLEPATHS", ((HostAppServ)HostApplicationServices.Current).FindConfigPath(String.Format("PrinterStyleSheetDir")));
            //    using (Database db = new Database())
            //    {

            //        HostApplicationServices.WorkingDatabase = db;
            //        InitConfig.InitStandardConfig(db);
            //        int OverAllScale = (int)selectScale;
            //        System.Data.DataTable dtProject;
            //        DrawingPierStructure P1 = new DrawingPierStructure(pierParaFile, type, out dtProject);
            //        P1.DrawingPier(db, OverAllScale);
            //    }
            //}
        }
   
    }
}
